package com.csun.cmny.provider.web.rpc;

import com.csun.cmny.provider.dao.OmcReviseMapper;
import com.csun.cmny.provider.model.domain.*;
import com.csun.cmny.provider.model.vo.OldmanBedRoomBuildingVo;
import com.csun.cmny.provider.model.vo.ReviseVo;
import com.csun.cmny.provider.pojo.Room;
import com.csun.cmny.provider.service.*;
import com.csun.cmny.util.PublicUtil;
import com.csun.cmny.util.wrapper.WrapMapper;
import com.csun.cmny.util.wrapper.Wrapper;
import com.google.common.collect.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-12-13 14:42
 * @Description:
 */
@RestController
public class OmcReviseFeignClient implements OmcReviseFeignApi {

    @Resource
    private OmcReviseMapper omcReviseMapper;
    @Resource
    private OmcReviseBedService omcReviseBedService;
    @Resource
    private OmcReviseItemService omcReviseItemService;
    @Resource
    private OldmanService oldmanService;
    @Resource
    private RoomService roomService;

    /**
     * oldid        - 老人Id
     * nursingGroupId   - 班组Id
     * oldmanName   - 老人姓名
     * reason       - 调整原因 1 身体条件变差 2 老人不适应 3 主动调整
     * revisedate   - 调整日期
     * levelbf      - 调整前护理等级
     * levelat      - 调整后护理等级
     * feesbf       - 调整前 - 减免后的护理费
     * feesbfred    - 调整前 - 减免的护理费
     * feesat       - 调整后 - 减免后的护理费
     * feered       - 调整后 - 减免的护理费
     * servicebf    - 调整前个性化护理，多项通过;隔离
     * serviceat    - 调整后个性化护理，多项通过;隔离
     * servicefeesbf    - 调整前 - 减免后的个性化护理费
     * servicefeesbfred - 调整前 - 减免的个性化护理费
     * servicefeesat    - 调整后 - 减免后的个性化护理费
     * servicefeesred   - 调整后 - 减免的个性化护理费
     * bedbf        - 调整前床位
     * bedat        - 调整后床位
     * bedfeesbf    - 调整前 - 减免后的床位费
     * bedfeesbfred - 调整前 - 减免的床位费
     * bedfeesat    - 调整后 - 减免后的床位费
     * bedfeesred   - 调整后 - 减免的床位费
     * foodbf       - 调整前伙食
     * foodat       - 调整后伙食
     * foodfeesbf   - 调整前 - 减免后的伙食费
     * foodfeesbfred    - 调整前 - 减免的伙食费
     * foodfeesat       - 调整后 - 减免后的伙食费
     * foodfeesred      - 调整后 - 减免的伙食费
     * agio         - 差价
     * state        - 状态 1 未提交 2 申请中 3 部长审核通过 4 审核未通过 5 接待室确认 6 收费室确认
     * desc         - 调整说明
     * days         - 补缴天数
     * processinstanceid
     * homeid
     */

    @Override
    public Wrapper<Integer> initRevise(@RequestBody ReviseVo reviseVo) {

        /**
         *  oldmanId    - 老人Id
         *  oldmanName  - 老人名称
         *  reason      - 调整原因 1 身体条件变差 2 老人不适应 3 主动调整
         *  date        - 调整日期
         *  packFee     - 套餐退费
         *  leaveFee    - 请假退费
         *  leaveDays   - 请假天数
         *  payDays     - 补缴天数
         *  state       - 状态 1 未提交 2 申请中 3 部长审核通过 4 审核未通过 5 接待室确认 6 收费室确认
         *  agio        - 差价
         *  total       - 总金额
         *  processInstanceId
         *  remark      - 备注
         *  nursingGroupId  - 班组Id
         *  groupId     - 组织Id
         *  billId      - 账单Id
         */
        OmcRevise omcRevise = new OmcRevise();  //

        omcRevise.setId(reviseVo.getId().longValue());
        omcRevise.setOldmanId(reviseVo.getOldmanId());
        omcRevise.setOldmanName(reviseVo.getOldmanName());
        omcRevise.setReason(reviseVo.getReason());
        omcRevise.setDate(reviseVo.getReviseDate());
        omcRevise.setPackFee(BigDecimal.ZERO);
        omcRevise.setLeaveDays(0);
        omcRevise.setLeaveFee(BigDecimal.ZERO);
        omcRevise.setPayDays(reviseVo.getDays());
        omcRevise.setState(reviseVo.getState());
        omcRevise.setAgio(reviseVo.getAgio());
        omcRevise.setGroupId(reviseVo.getHomeId().longValue());
        omcRevise.setRemark(reviseVo.getDesc());
        omcRevise.setTotal(reviseVo.getAgio());
        omcRevise.setNursingGroupId(reviseVo.getNursingGroupId());
        omcRevise.setCreatorId(reviseVo.getModifier());
        omcRevise.setLastOperatorId(reviseVo.getModifier());
        omcRevise.setCreatedTime(reviseVo.getCreatetime());
        omcRevise.setUpdateTime(reviseVo.getModifytime());
        omcRevise.setProcessInstanceId(reviseVo.getProcessinstanceid());
        omcReviseMapper.insert(omcRevise);

        /**
         * reviseId     - 调房调级Id
         * expenseTypeId    - 收费类别id
         * expenseItemId    - 收费项目id
         * itemType     - 缴费类型名
         * itemName     - 缴费项目名
         * itemFee      - 项目费用
         * userTypeRateRefief   - 人员类别减免费用
         * userRateRefief       - 人工减免费用
         * modelCode            - 缴费配置码 :1- 入院收费 2-周期收费 3-出院收费 4-非周期缴费
         * isOutReturn          - 是否退院退费 0.否 1.是
         * isLeaveReturn        - 是否请假退费 0.否 1.是
         * isAdjust     - 是否可以调整 0.否 1.是
         * isFixedPrice - 是否固定价格 0.否 1.是
         * actualFee    - 实际费用
         * amount       - 件数
         * usedDegree   - 使用次数
         * residueDegree        - 剩余次数
         * costType     - 收费频次方式（1-元/次 2-元/天  3-元/月  4-元/年 5-元/一次性）
         * code         - 缴费类别码 1.床位费 2.护理费 0.其他费用
         * adjustOrder  - 调整账单顺序 1.调整前 2.调整后
         *
         */
        List<OmcReviseItem> omcReviseItemList = Lists.newArrayList();

        Long expenseItemId = 0l;
        String itemType = "护理费";
        String itemName = "";
        BigDecimal itemFee = reviseVo.getFeesBf().add(reviseVo.getFeesBfRed());
        BigDecimal userTypeRateRefief = reviseVo.getBedFeesBfRed();
        BigDecimal userRateRefief = BigDecimal.ZERO;
        Integer modelCode = 2;
        Integer isOutReturn = 1;
        Integer isAdjust = 1;
        Integer isFixedPrice = 1;
        BigDecimal actualFee = reviseVo.getFeesBf();
        Integer amount = 0;
        BigDecimal usedDegree = BigDecimal.ONE;
        BigDecimal residueDegree = BigDecimal.ZERO;
        Integer costType = 3;
        Integer code = 2;
        Integer adjustOrder = 1;

        switch (reviseVo.getLevelBf()) {
            case "自理" :
                expenseItemId = 218l;
                itemName = "自理";
                break;
            case "半失能" :
                expenseItemId = 219l;
                itemName = "半失能";
                break;
            case "失能" :
                expenseItemId = 220l;
                itemName = "失能";
                break;
        }
        OmcReviseItem omcReviseItemLevelBefore = new OmcReviseItem();   //  调整前 - 护理
        omcReviseItemLevelBefore = getOmcReviseItem(omcRevise,
                123l, expenseItemId, itemFee, itemType, itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn,
                isAdjust, isFixedPrice, actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);

        omcReviseItemList.add(omcReviseItemLevelBefore);

        switch (reviseVo.getLevelAt()) {
            case "自理" :
                expenseItemId = 218l;
                itemName = "自理";
                break;
            case "半失能" :
                expenseItemId = 219l;
                itemName = "半失能";
                break;
            case "失能" :
                expenseItemId = 220l;
                itemName = "失能";
                break;
        }

        adjustOrder = 2;
        itemFee = reviseVo.getFeesAt().add(reviseVo.getFeeRed());
        userTypeRateRefief = reviseVo.getFeeRed();
        actualFee = reviseVo.getFeesAt();
        OmcReviseItem omcReviseItemLevelAfter = new OmcReviseItem();    //  调整后 - 护理
        omcReviseItemLevelAfter = getOmcReviseItem(omcRevise, 123l, expenseItemId, itemFee, itemType,
                itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn, isAdjust, isFixedPrice,
                actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);

        omcReviseItemList.add(omcReviseItemLevelAfter);

        OmcReviseItem omcReviseItemBedBefore = new OmcReviseItem();     //  调整前 - 床位
        OmcReviseItem omcReviseItemBedAfter = new OmcReviseItem();      //  调整后 - 床位

        switch (reviseVo.getFoodBf()) {
            case "老年公寓" :
                expenseItemId = 205l;
                itemName = "老年公寓";
                break;
            case "颐养中心" :
                expenseItemId = 204l;
                itemName = "颐养中心";
                break;
        }
        itemType = "餐饮费";
        itemFee = reviseVo.getFoodFeesBf().add(reviseVo.getFoodFeesRed());
        userTypeRateRefief = reviseVo.getFoodFeesRed();
        userRateRefief = BigDecimal.ZERO;
        modelCode = 2;
        isOutReturn = 1;
        isAdjust = 1;
        isFixedPrice = 1;
        actualFee = reviseVo.getFoodFeesBf();
        amount = 0;
        usedDegree = BigDecimal.ONE;
        residueDegree = BigDecimal.ZERO;
        costType = 3;
        code = 0;
        adjustOrder = 1;
        OmcReviseItem omcReviseItemFoodBefore = new OmcReviseItem();    //  调整前 - 伙食
        omcReviseItemFoodBefore = getOmcReviseItem(omcRevise, 120l, expenseItemId, itemFee, itemType,
                itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn, isAdjust, isFixedPrice,
                actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);
        omcReviseItemList.add(omcReviseItemFoodBefore);

        switch (reviseVo.getFoodAt()) {
            case "老年公寓" :
                expenseItemId = 205l;
                itemName = "老年公寓";
                break;
            case "颐养中心" :
                expenseItemId = 204l;
                itemName = "颐养中心";
                break;
        }
        itemType = "餐饮费";
        itemFee = reviseVo.getFoodFeesAt().add(reviseVo.getFoodFeesRed());
        userTypeRateRefief = reviseVo.getFoodFeesRed();
        userRateRefief = BigDecimal.ZERO;
        modelCode = 2;
        isOutReturn = 1;
        isAdjust = 1;
        isFixedPrice = 1;
        actualFee = reviseVo.getFoodFeesAt();
        amount = 0;
        usedDegree = BigDecimal.ONE;
        residueDegree = BigDecimal.ZERO;
        costType = 3;
        code = 0;
        adjustOrder = 2;
        OmcReviseItem omcReviseItemFoodAfter = new OmcReviseItem();    //  调整后 - 伙食
        omcReviseItemFoodAfter = getOmcReviseItem(omcRevise, 120l, expenseItemId, itemFee, itemType,
                itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn, isAdjust, isFixedPrice,
                actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);
        omcReviseItemList.add(omcReviseItemFoodAfter);

        if (PublicUtil.isNotEmpty(reviseVo.getServiceBf())) {   // 调整前个性化
            List<String> serviceItemList = Arrays.asList(reviseVo.getServiceBf().split(";"));
            for (String name : serviceItemList) {
                switch (name) {
                    case "每天清洗老人衣物" :
                        itemFee = new BigDecimal("200");
                        expenseItemId = 225l;
                        itemName = "每天清洗老人衣物";
                        break;
                    case "每周清洗老人衣物" :
                        itemFee = new BigDecimal("100");
                        expenseItemId = 224l;
                        itemName = "每周清洗老人衣物";
                        break;
                    case "每天送饭到房间清洗餐具" :
                        itemFee = new BigDecimal("100");
                        expenseItemId = 223l;
                        itemName = "每天送饭到房间清洗餐具";
                        break;
                    case "鼻饲护理" :
                        itemFee = new BigDecimal("600");
                        expenseItemId = 222l;
                        itemName = "鼻饲护理";
                        break;
                    case "压疮护理" :
                        itemFee = new BigDecimal("800");
                        expenseItemId = 221l;
                        itemName = "压疮护理";
                        break;
                    case "每周洗一次澡" :
                        itemFee = new BigDecimal("700");
                        expenseItemId = 261l;
                        itemName = "每周洗一次澡";
                        break;
                }
                itemType = "单项定制服务";
                // itemFee = ntRevise.getFoodfeesat();
                userTypeRateRefief = BigDecimal.ZERO;   // 默认没有减免
                userRateRefief = BigDecimal.ZERO;
                modelCode = 2;
                isOutReturn = 1;
                isAdjust = 1;
                isFixedPrice = 1;
                actualFee = itemFee;
                amount = 0;
                usedDegree = BigDecimal.ONE;
                residueDegree = BigDecimal.ZERO;
                costType = 3;
                code = 0;
                adjustOrder = 1;
                OmcReviseItem omcReviseItem = getOmcReviseItem(omcRevise, 124l, expenseItemId, itemFee, itemType,
                        itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn, isAdjust, isFixedPrice,
                        actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);
                omcReviseItemList.add(omcReviseItem);
            }
        }
        if (PublicUtil.isNotEmpty(reviseVo.getServiceAt())) {   // 调整后个性化

            List<String> serviceItemList = Arrays.asList(reviseVo.getServiceAt().split(";"));
            for (String name : serviceItemList) {
                switch (name) {
                    case "每天清洗老人衣物" :
                        itemFee = new BigDecimal("200");
                        expenseItemId = 225l;
                        itemName = "每天清洗老人衣物";
                        break;
                    case "每周清洗老人衣物" :
                        itemFee = new BigDecimal("100");
                        expenseItemId = 224l;
                        itemName = "每周清洗老人衣物";
                        break;
                    case "每天送饭到房间清洗餐具" :
                        itemFee = new BigDecimal("100");
                        expenseItemId = 223l;
                        itemName = "每天送饭到房间清洗餐具";
                        break;
                    case "鼻饲护理" :
                        itemFee = new BigDecimal("600");
                        expenseItemId = 222l;
                        itemName = "鼻饲护理";
                        break;
                    case "压疮护理" :
                        itemFee = new BigDecimal("800");
                        expenseItemId = 221l;
                        itemName = "压疮护理";
                        break;
                    case "每周洗一次澡" :
                        itemFee = new BigDecimal("700");
                        expenseItemId = 261l;
                        itemName = "每周洗一次澡";
                        break;
                }
                itemType = "单项定制服务";
                // itemFee = ntRevise.getFoodfeesat();
                //userTypeRateRefief = ntRevise.getFoodfeesred();
                userTypeRateRefief = BigDecimal.ZERO;   // 默认没有减免
                userRateRefief = BigDecimal.ZERO;
                modelCode = 2;
                isOutReturn = 1;
                isAdjust = 1;
                isFixedPrice = 1;
                actualFee = itemFee;
                amount = 0;
                usedDegree = BigDecimal.ONE;
                residueDegree = BigDecimal.ZERO;
                costType = 3;
                code = 0;
                adjustOrder = 2;
                OmcReviseItem omcReviseItem = getOmcReviseItem(omcRevise, 124l, expenseItemId, itemFee, itemType,
                        itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn, isAdjust, isFixedPrice,
                        actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);
                omcReviseItemList.add(omcReviseItem);
            }
        }



        /**
         * reviseId     - 调房调级Id
         * bedId        - 床位Id
         * bedNo        - 床位编号
         * roomId       - 房间Id
         * roomNo       - 房间编号
         * roomLink     - 房间与床位连接符
         * floorNo      - 楼层
         * buildingId   - 楼栋Id
         * buildingNo   - 楼栋编号
         * buildingName - 楼栋名
         * location     - 床位位置 [房间][房间连接符][床位]
         * bedOrder     - 调整床位顺序 1-调整前 2-调整后
         */
        List<OmcReviseBed> omcReviseBedList = Lists.newArrayList();

        if (PublicUtil.isNotEmpty(reviseVo.getBedBf())) {   // 调整前

            OmcReviseItem tmp = new OmcReviseItem();
            OmcReviseBed omcReviseBedBefore = getOmcReviseBed(omcRevise, reviseVo.getBedBf(), tmp);
            omcReviseBedBefore.setBedOrder(1);

            userTypeRateRefief = reviseVo.getBedFeesBfRed();
            userRateRefief = BigDecimal.ZERO;
            modelCode = 2;
            isOutReturn = 0;
            isAdjust = 1;
            isFixedPrice = 1;
            actualFee = reviseVo.getBedFeesBf();
            amount = 0;
            usedDegree = BigDecimal.ONE;
            residueDegree = BigDecimal.ZERO;
            costType = 3;
            code = 1;
            adjustOrder = 1;
            itemType = "床位费";
            itemFee = reviseVo.getBedFeesBf().add(reviseVo.getBedFeesBfRed());
            itemName = tmp.getItemName();
            expenseItemId = tmp.getExpenseItemId();

            omcReviseItemBedBefore = getOmcReviseItem(omcRevise, 122l, expenseItemId, itemFee, itemType,
                    itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn, isAdjust, isFixedPrice,
                    actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);

            omcReviseItemList.add(omcReviseItemBedBefore);

            omcReviseBedList.add(omcReviseBedBefore);
        }

        if (PublicUtil.isNotEmpty(reviseVo.getBedAt())) {

            OmcReviseItem tmp = new OmcReviseItem();
            OmcReviseBed omcReviseBedAfter = getOmcReviseBed(omcRevise, reviseVo.getBedAt(), tmp);
            omcReviseBedAfter.setBedOrder(2);

            userTypeRateRefief = reviseVo.getBedFeesRed();
            userRateRefief = BigDecimal.ZERO;
            modelCode = 2;
            isOutReturn = 0;
            isAdjust = 1;
            isFixedPrice = 1;
            actualFee = reviseVo.getBedFeesAt();
            amount = 0;
            usedDegree = BigDecimal.ONE;
            residueDegree = BigDecimal.ZERO;
            costType = 3;
            code = 1;
            adjustOrder = 2;
            itemType = "床位费";
            itemFee = reviseVo.getBedFeesAt().add(reviseVo.getBedFeesRed());
            itemName = tmp.getItemName();
            expenseItemId = tmp.getExpenseItemId();

            omcReviseItemBedAfter = getOmcReviseItem(omcRevise, 122l, expenseItemId, itemFee, itemType,
                    itemName, userTypeRateRefief, userRateRefief, modelCode, isOutReturn, isAdjust, isFixedPrice,
                    actualFee, amount, usedDegree, residueDegree, costType, code, adjustOrder);

            omcReviseItemList.add(omcReviseItemBedAfter);

            omcReviseBedList.add(omcReviseBedAfter);
        }
        if (PublicUtil.isNotEmpty(omcReviseBedList)) {
            omcReviseBedService.batchSave(omcReviseBedList);
        }

        if (PublicUtil.isNotEmpty(omcReviseItemList)) {
            omcReviseItemService.batchSave(omcReviseItemList);
        }

        if (reviseVo.getState().equals(6)) {    // 调整后

            // 老人账单 (cn_omc_oldman_bill)
            OmcOldManBill omcOldManBill = new OmcOldManBill();

            // 调整账单费用统计 (cn_omc_bill_adjust_fee)

            // 账单缴费项目 (cn_omc_bill_item)
        }

        /**
         * oldman_id
         * oldman_name
         * nursing_group_id
         */

        // 状态 1 未提交 2 申请中 3 部长审核通过 4 审核未通过 5 接待室确认 6 收费室确认

        // 调房调级记录 (cn_omc_revise)


        // 调房调级床位 (cn_omc_revise_bed)


        // 调房调级收费项 (cn_omc_revise_item)

        return WrapMapper.ok(1);
    }

    @Override
    public Wrapper<Integer> syncRevise(@RequestBody NtRevise ntRevise) {

        return WrapMapper.ok(1);
    }

    private OmcReviseBed getOmcReviseBed(OmcRevise omcRevise, String bed, OmcReviseItem omcReviseItem) {

        OmcReviseBed omcReviseBed = new OmcReviseBed();

        String tmp[] = bed.split("-");
        // 根据床位获取床位信息
        omcReviseItem.setExpenseItemId(null);
        omcReviseItem.setItemName("床位费");

        omcReviseBed.setReviseId(omcRevise.getId());
        omcReviseBed.setLocation(bed);

        OldmanBedRoomBuildingVo oldmanBedRoomBuildingVo = oldmanService.queryOldmanBedRoomBuildingByRoomNoAndBedNo(tmp[0], tmp[1]);
        if (oldmanBedRoomBuildingVo != null) {
            BeanUtils.copyProperties(oldmanBedRoomBuildingVo, omcReviseBed);

            omcReviseBed.setLocation(oldmanBedRoomBuildingVo.getRoomNo()
                    + oldmanBedRoomBuildingVo.getRoomLink()
                    + oldmanBedRoomBuildingVo.getBedNo());

            Room room = roomService.selectById(oldmanBedRoomBuildingVo.getRoomId());
            if (room.getHasToilet().equals(1)) {
                switch (room.getBedNum()) {
                    case 1 :
                        omcReviseItem.setExpenseItemId(214l);
                        omcReviseItem.setItemName("单人间带厕所");
                        break;
                    case 2 :
                        omcReviseItem.setExpenseItemId(215l);
                        omcReviseItem.setItemName("双人间带厕所");
                        break;
                    case 3 :
                        omcReviseItem.setExpenseItemId(216l);
                        omcReviseItem.setItemName("三人间带厕所");
                        break;
                    case 4 :
                        omcReviseItem.setExpenseItemId(217l);
                        omcReviseItem.setItemName("四人间及以上带厕所");
                        break;
                }
                if (room.getBedNum().compareTo(4) >= 0) {
                    omcReviseItem.setExpenseItemId(213l);
                    omcReviseItem.setItemName("四人间及以上");
                }
            }

            if (room.getHasToilet().equals(0)) {
                switch (room.getBedNum()) {
                    case 1 :
                        omcReviseItem.setExpenseItemId(210l);
                        omcReviseItem.setItemName("单人间");
                        break;
                    case 2 :
                        omcReviseItem.setExpenseItemId(211l);
                        omcReviseItem.setItemName("双人间");
                        break;
                    case 3 :
                        omcReviseItem.setExpenseItemId(212l);
                        omcReviseItem.setItemName("三人间");
                        break;
                    case 4 :
                        omcReviseItem.setExpenseItemId(213l);
                        omcReviseItem.setItemName("四人间及以上");
                        break;
                }
                if (room.getBedNum().compareTo(4) >= 0) {
                    omcReviseItem.setExpenseItemId(213l);
                    omcReviseItem.setItemName("四人间及以上");
                }
            }
        }



        return omcReviseBed;
    }

    private OmcReviseItem getOmcReviseItem(OmcRevise omcRevise, Long expenseTypeId, Long expenseItemId, BigDecimal itemFee, String itemType, String itemName,
                                           BigDecimal userTypeRateRefief, BigDecimal userRateRefief, Integer modelCode, Integer isOutReturn,
                                           Integer isAdjust, Integer isFixedPrice, BigDecimal actualFee, Integer amount, BigDecimal usedDegree,
                                           BigDecimal residueDegree, Integer costType, Integer code, Integer adjustOrder) {

        OmcReviseItem omcReviseItem = new OmcReviseItem();
        omcReviseItem.setItemFee(itemFee);
        omcReviseItem.setUserTypeRateRefief(userTypeRateRefief);
        omcReviseItem.setUserRateRefief(userRateRefief);
        omcReviseItem.setIsFixedPrice(isFixedPrice);
        omcReviseItem.setUsedDegree(usedDegree);
        omcReviseItem.setIsLeaveReturn(isOutReturn);
        omcReviseItem.setResidueDegree(residueDegree);
        omcReviseItem.setModelCode(modelCode);
        omcReviseItem.setCode(code);
        omcReviseItem.setReviseId(omcRevise.getId());
        omcReviseItem.setCostType(costType);
        omcReviseItem.setIsAdjust(isAdjust);
        omcReviseItem.setExpenseTypeId(expenseTypeId);
        omcReviseItem.setExpenseItemId(expenseItemId);
        omcReviseItem.setItemType(itemType);
        omcReviseItem.setItemName(itemName);
        omcReviseItem.setActualFee(actualFee);
        omcReviseItem.setAmount(amount);
        omcReviseItem.setAdjustOrder(adjustOrder);
        omcReviseItem.setCreator(omcRevise.getCreator());
        omcReviseItem.setCreatorId(omcRevise.getCreatorId());
        omcReviseItem.setCreatedTime(omcRevise.getCreatedTime());
        omcReviseItem.setLastOperator(omcRevise.getLastOperator());
        omcReviseItem.setLastOperatorId(omcRevise.getLastOperatorId());
        omcReviseItem.setUpdateTime(omcRevise.getUpdateTime());

        return omcReviseItem;
    }
}
